#pragma once
#include <string>
#include <map>
#include <vector>
#include <mydll.h>

using namespace std;

class EXPORT GlsManager
{
public:
	typedef map<string, string> NameCodeMap;
	typedef pair<string, string> NameCodePair;
	typedef NameCodeMap::iterator NameCodeMapIter;
	typedef NameCodeMap::const_iterator NameCodeMapConstIter;

	typedef struct
	{
		string name;
		int dayYK;
	}JXInfo;
	typedef map<string, JXInfo*> JXInfoMap;
	typedef pair<string, JXInfo*> JXInfoPair;
	typedef JXInfoMap::iterator JXInfoMapIter;
	typedef JXInfoMap::const_iterator JXInfoMapConstIter;

	typedef struct
	{
		string code;
		string noPrefix;
		string name;
		mutable NameCodeMap Blds;
		mutable NameCodeMap Lqcs;
		mutable NameCodeMap Xzhqs;
		mutable NameCodeMap Zjzls;
		mutable JXInfoMap JXInfo;

		const string NextBld(const string& curBld) const
		{
			NameCodeMap::const_iterator iter = Blds.find(curBld);
			if (iter == Blds.end())
				return "";
			++iter;
			if (iter == Blds.end())
				iter = Blds.begin();
			return iter->first;
		}
	}Gls;
	typedef map<string, Gls*> CityGlsMap;
	typedef pair<string, Gls*> CityGlsPair;
	typedef CityGlsMap::iterator CityGlsMapIter;
	typedef CityGlsMap::const_iterator CityGlsMapConstIter;
	
	static GlsManager* GetInstance(void);
	const Gls* GetGls(const string& name) const;
	std::vector<std::string> GetGlsList(void) const;
	std::vector<std::string> GetJXList(void) const;

private:
	GlsManager();

	// Forbidden copy constructing
	GlsManager(const GlsManager& instance){}

	static GlsManager* _instance;

	CityGlsMap cityGlsMap;
};